package com.example.quartz;

import com.example.service.UsersService;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

public class QuartzDemo implements Job {

    private static final Logger logger = LoggerFactory.getLogger(QuartzDemo.class);

    @Autowired
    private UsersService usersService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("Execute...{}", new Date());
        this.usersService.addUsers();
    }

}
